﻿using System;

namespace test2
{
    class Array
    {
        static int MinNum(int[] arr)
        {
            if (arr == null)
                return -0xFFFF;
            int min = arr[0];
            foreach (int i in arr)
                if (i < min)
                    min = i;
            return min;
        }

        static int MaxNum(int[] arr)
        {
            if (arr == null)
                return 0xFFFF;
            int max = arr[0];
            foreach (int i in arr)
                if (i > max)
                    max = i;
            return max;
        }

        static int Sum(int[] arr)
        {
            if (arr == null)
                return 0;
            int sum = arr[0];
            foreach (int i in arr)
                    sum += i;
            return sum;
        }

        static double Avg(int[] arr)
        {
            int length=arr.Length;
            return 1.0*Sum(arr)/length;
        }

        static void Main(string[] args)
        {
            int[] arr = new int[] { 0, 21, 52, -4, 4, 755, 24, -207, 9 };
            Console.WriteLine(MaxNum(arr));
            Console.WriteLine(MinNum(arr));
            Console.WriteLine(Sum(arr));
            Console.WriteLine(Math.Round(Avg(arr), 4));
        }
    }
}